home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.1 (Developer) [x86]
/
NeXT Step 3.1 Intel dev.cdr.dmg
/
NextDeveloper
/
Examples
/
SoundAndMusic
/
SoundLibrary
/
recordfiletest.c
< prev
next >
Wrap
Text File
|
1990-10-10
|
1KB
|
39 lines
/*
* recordfiletest - use the sound library to record directly to a file.
* This example records from the codec microphone, but note that using
* SNDStartRecordingFile() is especially useful for high sample rate
* recording from the DSP. Also note that when recording from the DSP, the
* dataFormat of the resulting soundfile must be changed to a playable format
* (like SND_FORMAT_LINEAR_16) before it can be played back.
*
* The use of SNDAlloc() causes virtual memory to be allocated, but since
* samples are written directly to a file, this VM is never touched.
*/
#import <sound/sound.h>
#import <stdio.h>
#define SECONDS 5.0
main (int argc, char *argv[])
{
int err;
SNDSoundStruct *s;
if (argc != 2) {
printf("usage : recordfiletest file\n");
exit(1);
}
err = SNDAlloc(&s,SECONDS*SND_RATE_CODEC,SND_FORMAT_MULAW_8,
SND_RATE_CODEC,1,0);
if (err) fprintf(stderr,"recordfiletest : cannot allocate buffer\n");
printf("recording...\n");
err = SNDStartRecordingFile(argv[1],s,1,1,0,0,0);
if (err) fprintf(stderr,"recordfiletest : cannot start recording\n");
SNDWait(0);
SNDFree(s);
exit(0);
}